package com.magic233.controller;

import com.magic233.service.CodeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * ClassName: CodeController
 * Description:
 * date: 2021/5/29 21:24
 * author: zouyuan
 */
@RestController
public class CodeController {

    @Autowired
    private CodeService codeService;

    //将验证码绑定到手机号
    @RequestMapping("/sendCode")
    public Object sendCode(String phone) {
        System.out.println("发送验证码" + phone);
        if (phone == null || "".equals(phone)) {
            return 0;
        }
        long re = codeService.sendCode(phone);
        return re;
        //1为成功，0为失败
    }

}
